<?php get_header(); ?>

    <!---- BODY ----->
    <div id="body" class="width-100per bg-color-white">
        <div id="content" class="div-center width-x1000 bg-color-white padding-top-x10 padding-bottom-x10"  style="min-height: 500px;">
<?php get_template_part('breadcrumbs'); ?>
            <div class="clear"></div>
            <div class="product-block" >
                <?php
                    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
                    query_posts('posts_per_page=10&paged=' . $paged); 
                    if(have_posts()) : while(have_posts()) : the_post(); 
                ?>
                <?php 
                    $img = get_post_meta($post -> ID, "imagelink1",true);
                    $price = get_post_meta($post -> ID, "price",true);
                    $discount = get_post_meta($post -> ID, "discount",true);
                ?>
                <a href="<?php the_permalink();?>" class="product_links">
                    <?php if ( has_post_thumbnail() ) {
                    	the_post_thumbnail('thumbnail', array('class' => 'product-items'));
                        }
                        else if($img != '') {
                            echo '<div class="product-item-cover"><div style=" position: relative; background: url('. $img . ') 0 0 no-repeat; background-size: cover;" class="product-items product-item-'. $post -> ID .'"></div>
                            <div class="product-info product-info-' . $post -> ID .'">
                                <p class="product-title">' . get_the_title() . '</p>
                                <p class="product-price">Giá: ' . $price . '</p>
                                <p class="product-discount">Khuyến mãi: ' . $discount . '</p>
                            </div></div>';
                        }
                        else {
                        	echo '<div class="product-item-cover"><div style="position: relative; background: url(' . get_bloginfo( 'template_directory' ) . '/images/no_image.gif) 0 0 no-repeat; background-size: cover;" class="product-items"></div>
                            <div class="product-info">
                                <p class="product-title">' . get_the_title() . '</p>
                                <p class="product-price">Giá: ' . $price . '</p>
                                <p class="product-discount">Khuyến mãi: ' . $discount . '</p>
                            </div></div>';
                        }
                    ?>
                    <script type="text/javascript">
                        $(document).ready(function() {
                            //show / hide feedback form function
                            $('.product-item-<?php echo $post -> ID;?>').hover(function() {
                                $('.product-info-<?php echo $post -> ID;?>').animate({height:'50%'},'slow');
                            },
                            function() {
                                $('.product-info-<?php echo $post -> ID;?>').animate({height:'-=50%'},'fast');
                            });
                        });
                    </script>
                </a>
                <?php endwhile; ?>
                    <div class="clear"></div>
                    <p class="izship_pagination">
                        <?php izship_pagination(); ?>
                    </p>
                <?php else: ?>
                    <h1>Sorry, There are no posts to display</h1>
                <?php endif;  ?>
            </div>
<?php the_tags('Resource: &nbsp',', '); ?>
        </div>
    </div> 
<?php get_footer(); ?>